<?php
/**
 * Created by PhpStorm.
 * User: kongqi
 * Date: 2019/11/30
 * Time: 3:28
 */

namespace App\Plugin\HostServer\Front;

use App\Plugin\HostServer\Models\PnHostSvGood;
use App\Plugin\HostServer\Models\PnHostSvPage;

class IndexController extends  BaseController
{
    public function index(){
        $title=config_cache_default('host_server.seo_title');
        $key=config_cache_default('host_server.seo_key',$title);;
        $desc=config_cache_default('host_server.seo_desc',$title);;;
        $this->setSeo($title,$key,$desc);
        //热门服务器
        $goods=PnHostSvGood::checked()->hot()->limit(4)->sortDesc()->get();
        $data=[
            'goods'=>$goods
        ];

        return $this->display($data);
    }
    public function  page($id)
    {
        $page=PnHostSvPage::find($id);
        $title = $page->seo_title ?: $page->name;
        $key = $page->seo_key ?: $page->seo_title;
        $desc = $page->seo_desc ?: $page->seo_title;
        $this->setSeo($title, $key, $desc);
        $data=[
            'show'=>$page
        ];
        return $this->display($data);
    }
}